package com.jic.market.mapper;

import com.jic.market.entity.PromotionMerchantEntity;
import com.jic.market.orm.BaseMapper;
import com.jic.market.entity.PatchGrouponMerchantEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface PatchGrouponMerchantEntityMapper extends BaseMapper<PatchGrouponMerchantEntity>{

    Integer updateByPromotionId(PatchGrouponMerchantEntity entity);

    List<PatchGrouponMerchantEntity> findAllByMerchantIds(@Param("merchantIds") List<Long> merchantIds);

    List<PatchGrouponMerchantEntity> findAllByStoreIds( @Param("storeIds") List<Long> storeIds);

    /**
     * 根据商家 ids，和促销 id，查询所有店铺。
     * @param merchantIds
     * @param promotionId
     * @return
     */
    List<PatchGrouponMerchantEntity> findAllStoreByMerchantIds(@Param("promotionId") Long promotionId, @Param("merchantIds") List<Long> merchantIds);

    /**
     * 通过商家ids 列表删除，店铺
     * @param promotionId
     * @param merchantIds
     * @return
     */
    Integer deleteStoreListByMerchantIds(
            @Param("promotionId") Long promotionId, @Param("merchantIds") List<Long> merchantIds);

    /**
     * 通过促销店铺ids 删除，店铺
     * @param ids
     * @return
     */
    Integer deleteStoreListByIds(@Param("list") List<Long> ids);

    int insertBatch(@Param("items")List<PatchGrouponMerchantEntity> patchGrouponMerchantEntityList);
}